﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using GeniePlugin;

namespace CombatCalcPlugin
{
    public partial class Form1 : Form
    {
        GeniePlugin.Interfaces.IHost _iHost;

        public Form1()
        {
            InitializeComponent();
        }

        public Form1(ref GeniePlugin.Interfaces.IHost iHost)
        {
            this._iHost = iHost;
            InitializeComponent();
            if (this._iHost.get_Variable("combatCalc.Parry") == "1")
                this.cbParry.Checked = true;
            if (this._iHost.get_Variable("combatCalc.Evasion") == "1")
                this.cbEvasion.Checked = true;
            if (this._iHost.get_Variable("combatCalc.Shield") == "1")
                this.cbShield.Checked = true;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this._iHost.set_Variable("combatCalc.Evasion", this.cbEvasion.Checked == true ? "1" : "0");
            this._iHost.set_Variable("combatCalc.Parry", this.cbParry.Checked == true ? "1" : "0");
            this._iHost.set_Variable("combatCalc.Shield", this.cbShield.Checked == true ? "1" : "0");
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
